// components/paging-scroll-view/paging-scroll-view.js
Component({
    options: {
      multipleSlots: true,
    },
    properties: {
      scrollY: {
        type: Boolean,
        value: false,
      },
      refreshingText: {
        type: String,
        value: '正在刷新...',
      },
      loadingText: {
        type: String,
        value: '加载中...',
      },
      noMoreText: {
        type: String,
        value: '没有更多数据了',
      },
      style: {
        type: String,
        value: '',
      },
    },
    data: {
      refreshing: false,
      loading: false,
      hasMore: true,
    },
    methods: {
      onScrollToLower: function() {
        if (this.data.loading || !this.data.hasMore) {
          return;
        }
        this.setData({loading: true});
        this.triggerEvent('loadmore');
      },
      onScrollToUpper: function() {
        if (this.data.refreshing) {
          return;
        }
        this.setData({refreshing: true});
        this.triggerEvent('refresh');
      },
      completeLoading: function(hasMore) {
        this.setData({
          refreshing: false,
          loading: false,
          hasMore,
        });
      },
    },
  });
  